<html>
  <body>

    <input  type="file"  id="fileInput"/>
  </body>
  <script>

const fileInput = document.getElementById("fileInput");

const reader = new FileReader();

fileInput.onchange = (e) => {
    reader.readAsDataURL(e.target.files[0]);
}

reader.onload = (e) => {
    console.log(e.target.result);
}

  </script>
</html>